package model.trajectory;

import java.util.ArrayList;
import java.util.Iterator;

import colors.Color;

import model.BaseModel;
import model.path.Point4D;

import utils.Point3D;
import utils.TimeIntervalle;

public abstract class BaseTrajectoryModel  extends BaseModel
{
	public TrajectoryModel parent;
	
	private Color color;
	public TimeIntervalle intervalle;
	public ArrayList<Point4D> positions;
	
	public BaseTrajectoryModel(TrajectoryModel parent, TimeIntervalle intervalle, ArrayList<Point4D> positions)
	{
		super(parent.getID());
		this.parent = parent;
		this.intervalle = intervalle;
		this.positions = positions;
	}
	
	public BaseTrajectoryModel(TrajectoryModel parent, TimeIntervalle intervalle)
	{
		super(parent.getID());
		this.positions = new ArrayList<Point4D>();
		this.parent = parent;
		this.intervalle = intervalle;
	}

	public abstract String toSaveText();

	public ArrayList<Point3D> toPoint3DList() 
	{
		ArrayList<Point3D> result = new ArrayList<Point3D>();

		for(Iterator<Point4D> it = positions.iterator(); it.hasNext();)
		{
			result.add(it.next());
		}
		
		return result;
	}

	public void setColor(Color color) {
		// TODO Auto-generated method stub
		this.color = color;
	}

	public Color getColor() {
		return color;
	}
	
	public boolean isHighlighted() {
		// TODO Auto-generated method stub
		return parent.isHighlighted();
	}
	
	public boolean isVisible() {
		// TODO Auto-generated method stub
		return this.parent.isVisible();
	}

}
